package io.lkt.modules.sys.service.impl;

import io.lkt.commons.dynamic.datasource.annotation.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;

import io.lkt.modules.sys.dao.PythonArticleInfoDao;
import io.lkt.modules.sys.entity.PythonArticleInfoEntity;
import io.lkt.modules.sys.service.PythonArticleInfoService;


@Service("pythonArticleInfoService")
public class PythonArticleInfoServiceImpl extends ServiceImpl<PythonArticleInfoDao, PythonArticleInfoEntity> implements PythonArticleInfoService {
    @Autowired
    PythonArticleInfoDao articleInfoDao;

    @Override
    @DataSource("slave1")
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PythonArticleInfoEntity> page = this.page(
                new Query<PythonArticleInfoEntity>().getPage(params),
                new QueryWrapper<PythonArticleInfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    @DataSource("slave1")
    public List<PythonArticleInfoEntity> queryList(Map<String, Object> map) {
        return articleInfoDao.queryList(map);
    }

    @Override
    @DataSource("slave1")
    public Integer queryTotal(Map<String, Object> map) {
        return articleInfoDao.queryTotal(map);
    }

    @Override
    @DataSource("slave1")
    public List<PythonArticleInfoEntity> byBrandName(Map<String, Object> map) {
        return articleInfoDao.byBrandName(map);
    }

    @Override
    @DataSource("slave1")
    public PythonArticleInfoEntity getInfo(Integer id) {
        return articleInfoDao.getInfo(id);
    }

    @Override
    @DataSource("slave1")
    public Integer elseTotal(Map<String, Object> map) {
        return articleInfoDao.elseTotal(map);
    }

    @Override
    @DataSource("slave1")
    public Integer upDel(Map<String, Object> map) {
        return articleInfoDao.upDel(map);
    }

    @Override
    @DataSource("slave1")
    public Integer delById(Integer id) {
        return articleInfoDao.delById(id);
    }

    @Override
    @DataSource("slave1")
    public Integer noImportCount() {
        return articleInfoDao.noImportCount();
    }

    @Override
    @DataSource("slave1")
    public Integer updateArticleThumbnail(Integer id,String articleThumbnail){
        return articleInfoDao.updateArticleThumbnail(id,articleThumbnail);
    }


    @Override
    @DataSource("slave1")
    public Integer updateInfo(PythonArticleInfoEntity bArticleInfo){
        return articleInfoDao.updateInfo(bArticleInfo);
    }

}
